module.exports = function(sequelize, DataTypes) {
  var User = sequelize.define('User', {
    id: {
      type: DataTypes.INTEGER,
      primaryKey: true,
      autoIncrement: true
    },
    email: {
      type: DataTypes.STRING,
      unique: true
    },
    username: DataTypes.STRING,
    password: DataTypes.STRING,
    verified: DataTypes.BOOLEAN,
    registered: DataTypes.BOOLEAN, // can be just a participant
  }, {
    classMethods: {
      associate: function(models) {
        User.hasMany(models.Location);
        User.hasMany(models.Conversation, {through:'conversations_and_participants'});
        User.hasMany(models.Conversation, {as: 'StartedBy', foreignKey:'owner_id'});
        User.hasMany(models.Group, {
          through: 'group_members'
        })
        User.hasMany(models.Note)
      }
    }
  });

  return User
};